.truncate {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    hyphens: auto;
    -webkit-user-select: text;  /* Chrome all / Safari all */
    -moz-user-select: text;     /* Firefox all */
    -ms-user-select: text;      /* IE 10+ */
    user-select: text;
}

.PostAttachmentOpenGraph {
    position: relative;
    display: grid;
    width: 100%;
    max-width: 700px;
    padding: 16px;
    border: 1px solid rgba(var(--center-channel-color-rgb), 0.16);
    border-radius: 4px;
    margin: 5px 0;
    background-color: var(--center-channel-bg);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.08);

    /**
     * This is a little hacky way to say every column that gets auto-generated
     * by placing an item outside of the grid will get 80px wide. We use this here
     * to place a small image outside of the grid, but a big one in the row below
     */
    grid-auto-columns: 80px;
    grid-template-columns: 1fr;

    /** For some reason just setting this on :hover is not sufficient, therefore the !important */
    text-decoration: none !important;
    transition: box-shadow;

    &:hover:not(:active) {
        border-color: rgba(var(--center-channel-color-rgb), 0.24);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
    }

    &:hover {
        .remove-button {
            display: block;
        }
    }

    &:active {
        border-color: rgba(var(--button-bg-rgb), 0.32);
    }

    .remove-button {
        position: absolute;
        z-index: 10;
        top: -1px;
        left: -28px;
        display: none;
        padding: 5px;
        border-radius: 4px;
        background-color: rgba(var(--center-channel-color-rgb), 0);
        color: rgba(var(--center-channel-color-rgb), 0.75);

        &:hover:not(:active) {
            background-color: rgba(var(--center-channel-color-rgb), 0.08);
            color: rgba(var(--center-channel-color-rgb), 0.8);
        }

        &:active {
            background-color: rgba(var(--button-bg-rgb), 0.16);
            color: rgba(var(--button-bg-rgb), 1);
        }
    }

    &__body {
        .sitename,
        .title {
            @extend .truncate;

            -webkit-line-clamp: 1;
            word-break: break-all;
        }

        .sitename {
            color: rgba(var(--center-channel-color-rgb), 0.75);
            font-size: 11px;
            font-weight: 400;
            line-height: 16px;
        }

        .title {
            margin-bottom: 4px;
            color: var(--link-color);
            font-size: 14px;
            font-weight: 600;
            line-height: 20px;
        }

        .description {
            @extend .truncate;

            color: var(--center-channel-color);
            font-size: 14px;
            font-weight: 400;
            -webkit-line-clamp: 2;
            line-height: 20px;
            word-break: none;
        }

        .isInPermalink {
            overflow: hidden;
            width: 100%;
            height: 1.5em;
            line-height: 1.5em;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }

    &__image {
        position: relative;
        display: flex;
        overflow: visible;
        height: 80px;
        border-radius: 4px;
        grid-column: 2 / 3;
        grid-row: 1 / 2;
        place-content: stretch;
        place-items: stretch;

        &.large {
            width: auto;
            max-width: 392px;
            height: auto;
            max-height: 240px;
            margin-top: 12px;
            grid-column: 1 / 2;
            grid-row: 2 / 3;
            place-content: center;
            place-items: center;
        }

        figure {
            overflow: hidden;
            max-width: 392px;
            max-height: 240px;
            border-radius: 4px;

            img {
                min-width: 100%;
                min-height: 100%;
                object-fit: cover;
            }
        }

        .preview-toggle {
            position: absolute;
            top: -4px;
            left: -4px;
            display: flex;
            width: 24px;
            height: 24px;
            border: 1px solid rgba(var(--center-channel-color-rgb), 0.16);
            border-radius: 50%;
            background-color: var(--center-channel-bg);
            color: rgba(var(--center-channel-color-rgb), 0.75);
            font-size: 12px;
            place-content: center;
            place-items: center;
        }

        &.collapsed {
            place-content: start;
            place-items: start;

            .preview-toggle {
                position: relative;
                top: unset;
                left: unset;
                display: flex;
                width: auto;
                border: none;
                border-radius: 0;
                background-color: transparent;
            }
        }

        &:hover:not(.collapsed) {
            .preview-toggle {
                display: flex;
            }
        }
    }
}
